package zhongbo.java.air.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import zhongbo.java.air.common.vo.PageVo;
import zhongbo.java.air.common.vo.ResultVo;
import zhongbo.java.air.dictionary.model.Zone;
import zhongbo.java.air.dictionary.service.impl.ZoneServiceImpl;

/**
 * 说明：
 *
 * @author 钟波dellNotebook
 * @since 2025年04月01日 星期二 23:25:02
 */
@RestController
@RequestMapping("airAlertZone")
@Api(tags = "警戒区域配置接口")
public class AirAlertZoneController {

    @Autowired
    private ZoneServiceImpl airAlertZoneService;

    @PostMapping("add")
    @ApiOperation("添加")
    ResultVo<Zone> add(@RequestBody Zone entity) {
        Zone airAlertZone = airAlertZoneService.add(entity);
        return ResultVo.ok(airAlertZone);
    }

    @GetMapping("delete")
    @ApiOperation("删除")
    ResultVo<String> delete(String entityId) {
        String delete = airAlertZoneService.delete(entityId);
        return ResultVo.ok(delete);
    }

    @PostMapping("edit")
    @ApiOperation("修改")
    ResultVo<Zone> edit(@RequestBody Zone edit) {
        Zone airAlertZone = airAlertZoneService.edit(edit);
        return ResultVo.ok(airAlertZone);
    }

    @GetMapping("findOne")
    @ApiOperation("查询一条")
    ResultVo<Zone> findOne(String entityId) {
        Zone airAlertZone = airAlertZoneService.findAirPort(entityId);
        return ResultVo.ok(airAlertZone);
    }

    @GetMapping("findPage")
    @ApiOperation("分页查询列表")
    ResultVo<PageVo<Zone>> findPage(Integer page, Integer pageSize
            , String keyword, String fields
            , String oderByField, Boolean orderByAsc) {
        PageVo<Zone> pageVo = airAlertZoneService.pageVo(page, pageSize, keyword, fields, oderByField, orderByAsc);
        return ResultVo.ok(pageVo);
    }

}
